package com.example.qxfw.dlqx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.qxfw.common.entity.zy.PowerProduct;
import com.example.qxfw.dlqx.mapper.PowerProductMapper;
import com.example.qxfw.dlqx.service.PowerProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PowerProductServiceImpl implements PowerProductService {

    @Autowired
    private PowerProductMapper powerProductMapper;

    @Override
    public List<PowerProduct> listByProductName(String productName) {
        return powerProductMapper.selectList(Wrappers.<PowerProduct>lambdaQuery()
                .eq(PowerProduct::getProductname,productName));
    }

    @Override
    public Integer update(PowerProduct powerProduct) {
        return powerProductMapper.update(powerProduct,Wrappers.<PowerProduct>lambdaUpdate()
                .eq(PowerProduct::getProductname,powerProduct.getProductname()));
    }

    @Override
    public Integer save(PowerProduct powerProduct) {
        return powerProductMapper.insert(powerProduct);
    }
}
